<?php

namespace App\Admin\Controllers;

use App\Models\Pair;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class PairController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(Pair::with(['site']), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('site_id');
            $grid->column('site.site_name', '交易所');
            $grid->column('symbol');
            $grid->column('amount-precision');
            $grid->column('value-precision');
            $grid->column('sell-market-max-order-amt');
            $grid->column('sell-market-min-order-amt');
            $grid->column('buy-market-max-order-value');
            $grid->column('min-order-value');

            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
                $filter->equal('site_id');
                $filter->equal('site.name', '交易所');
                $filter->equal('symbol');
            });
            $grid->disableBatchDelete();
            $grid->disableRowSelector();
            $grid->disableActions();
            $grid->disableCreateButton();
        });
    }
}
